import * as React from "react";
import { Select, Button } from "antd";

import "./index.less";
const { Option } = Select;
export interface PriceFileConditionProps {
  onSubmit: (data: PriceFileConditionState) => any;
}

export interface PriceFileConditionState {
  priceType: string;
  isEnable: string;
}

class PriceFileCondition extends React.Component<
  PriceFileConditionProps,
  PriceFileConditionState
> {
  state = {
    priceType: "",
    isEnable: "",
  };
  render() {
    return (
      <div
        className="PriceFileCondition bare_body"
        style={{ padding: 16, paddingTop: 0 }}
      >
        <span style={{ paddingLeft: 26 }}>价格类型：</span>
        <Select
          style={{ width: 120, marginTop: 16 }}
          value={this.state.priceType}
          onChange={(e: string) => {
            this.setState({ priceType: e });
          }}
        >
          <Option value="0" key="0">
            单价
          </Option>
          <Option value="1" key="1">
            分时价格
          </Option>
          <Option value="" key="2">
            全部
          </Option>
        </Select>
        <span style={{ paddingLeft: 26 }}>所属分类：</span>
        <Select
          style={{ width: 120, marginTop: 16 }}
          value={this.state.isEnable}
          onChange={(e: string) => {
            this.setState({ isEnable: e });
          }}
        >
          <Option value="0" key="0">
            可用
          </Option>
          <Option value="1" key="1">
            不可用
          </Option>
          <Option value="" key="2">
            全部
          </Option>
        </Select>
        <Button
          type="primary"
          style={{ marginLeft: 26, marginTop: 16 }}
          onClick={() => {
            this.getCondition();
          }}
        >
          查询
        </Button>
      </div>
    );
  }
  getCondition() {
    this.props.onSubmit(this.state);
  }
}

export default PriceFileCondition;
